package com.itheima.d5_extendsconstructor;

public class Test2 {
    public static void main(String[] args) {
        //子类构造器调用父类构造器的应用场景
        Teacher t = new Teacher("aa");
        People p = new People("马苦玄");
        System.out.println(p.getName());
        System.out.println(p.getSex());
        System.out.println("----------------");
        System.out.println(t.getName());
        System.out.println(t.getSkill());
        System.out.println(t.getSex());


    }
}

class People {
    private String name;
    private char sex;

    public People() {
    }
    public People(String name) {
        this(name, '男');
    }

    public People(String name, char sex) {

        this.name = name;
        this.sex = sex;
    }

    public char getSex() {
        return sex;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}



class Teacher extends People {
    private String skill;
    public Teacher(){

    }
    //调用父类构造器


    public Teacher(String skill) {
        super("陈平安", '男');
        this.skill = skill;
    }

    public Teacher(String name, char sex, String skill) {
        super(name, sex);
        this.skill = skill;
    }

    public String getSkill() {
        return skill;
    }

    public void setSkill(String skill) {
        this.skill = skill;
    }
}
